home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1986 October / 1986-10.d64 / math attack (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  4KB  |  123 lines

  1. 10 for i=54272to54296:pokei,0:next
  2. 20 poke51,127:poke52,62:poke55,127:poke56,62:clr:goto40
  3. 30 print"";:forc=1to21:printc$:next:print"":return
  4. 40 c$="                                       ":printchr$(142);chr$(8)
  5. 50 print"[147]";:poke53280,0:poke53281,0:v=53248:poke54281,75
  6. 60 poke54296,15:f=54273:ad=f+4:sr=f+5:w=f+3:f2=f+7:w2=w+7:pokew+8,0:pokew+9,240
  7. 70 d$="":tb$=d$+""
  8. 80 print"   [175][185]  [162] [164]  [185] [162]  [164][175][185][162] [162][185][175][164]   [185][164][175] [175][164][162]  [164]"
  9. 90 print" [163]  [184][183] [184] [183][184] [163] [184][163]    [163]    [184][183][163]   [184]   [183][184] "
  10. 100 print"                                      ":bc=peek(v+31)
  11. 110 print"[156]type: +[146] (addition)"
  12. 120 print"-[146] (subtraction)"
  13. 130 print"x[146] (multiplication)"
  14. 140 gett$:ift$<>"+"andt$<>"-"andt$<>"x"then140
  15. 150 gosub30:dimn(10,7):poke56334,peek(56334)and254:poke1,peek(1)and251
  16. 160 cs=53632:forx=0to9:fory=0to7:n(x,y)=peek(cs):cs=cs+1:nexty,x
  17. 170 sn=-53440*(t$="x")-53592*(t$="+")-53608*(t$="-")
  18. 180 fory=0to7:n(10,y)=peek(sn):sn=sn+1:next
  19. 190 poke1,peek(1)or4:poke56334,peek(56334)or1
  20. 200 print"[158]level:   123"
  21. 210 print"(limits)   9     99     99"
  22. 220 print"         "t$" 9    "t$" 9    "t$"99"
  23. 230 print"         [163][163][163]    [163][163][163]    [163][163][163]"
  24. 240 getl$:ifl$<>"1"andl$<>"2"andl$<>"3"then240
  25. 250 l=val(l$):l1=-9*(l=1)-99*(l=2)-99*(l=3):l2=-9*(l=1)-9*(l=2)-99*(l=3)
  26. 260 gosub30:pokev,100:pokev+2,175:pokev+4,250:pokev+1,0:pokev+3,0:pokev+5,0
  27. 270 forx=16000to16191:readd:pokex,d:next:pokev+39,5:pokev+40,3:pokev+41,8
  28. 280 data0,0,0,0,0,0,0,0
  29. 290 data0,0,0,0,0,0,0,0
  30. 300 data0,0,0,16,0,0,74,0
  31. 310 data2,82,64,2,74,64,2,82
  32. 320 data64,17,36,136,9,36,144,41
  33. 330 data36,148,36,145,36,18,137,72
  34. 340 data73,82,146,36,137,36,18,82
  35. 350 data72,170,137,85,0,84,0,0
  36. 360 data0,170,0,5,85,64,21,85
  37. 370 data80,42,170,168,85,85,84,85
  38. 380 data85,84,85,85,84,42,170,168
  39. 390 data21,85,80,5,85,64,0,170
  40. 400 data0,0,0,0,0,0,0,0
  41. 410 data0,0,0,0,0,0,0,0
  42. 420 data0,0,0,0,0,0,0,0
  43. 430 data0,0,0,0,0,0,0,0
  44. 440 data96,0,1,96,64,2,16,35
  45. 450 data4,15,144,24,10,126,48,4
  46. 460 data173,96,4,30,18,70,35,192
  47. 470 data53,65,72,36,129,40,20,129
  48. 480 data72,28,129,192,36,2,66,124
  49. 490 data102,98,162,120,80,53,144,152
  50. 500 data1,73,48,2,6,80,4,2
  51. 510 data200,8,1,4,144,0,0,0
  52. 520 forx=16192to16384:pokex,0:next
  53. 530 poke2040,253:poke2041,254:poke2042,255
  54. 540 forsn=0to2:gosub1080:next:pokev+21,7:pokev+31,0:gosub30:poke198,0
  55. 550 y(0)=0:y(1)=30:y(2)=10:printd$"answers:[175]";tab(19);"bombs you missed: 0";
  56. 560 forx=0to2:y(x)=y(x)+1:next
  57. 570 pokev+1,y(0):pokev+3,y(1):pokev+5,y(2):bc=peek(v+31)
  58. 580 pokew2,17:pokef2,y(0):pokef2,y(1):pokef2,y(2):pokew2,0
  59. 590 ford=0to(l-1)*100:next
  60. 600 getn$:if(n$=>"0"andn$<="9")orn$="-"orn$=chr$(20)orn$=chr$(13)then700
  61. 610 bc=peek(v+31)and7:ifbc=0then560
  62. 620 if(bcand1)=1thensn=0:gosub660
  63. 630 if(bcand2)=2thensn=1:gosub660
  64. 640 if(bcand4)=4thensn=2:gosub660
  65. 650 goto560
  66. 660 bh=bh+1:pokev+1+sn*2,221:poke2040+sn,250:pokew,0:pokead,12:pokef,1
  67. 670 pokew,129:ford=1to100:next:pokew,0:pokew,129:poke2040+sn,251:ford=1to100
  68. 680 next:gosub1080:printtb$;tab(36)bh;:y(sn)=30:ifbh>2then890
  69. 690 poke2040+sn,253+sn:return
  70. 700 ifn$=chr$(20)andtb>0thentb=tb-1:print" [157][157][175][157]";:an$=left$(an$,len(an$)-1)
  71. 710 ifn$=chr$(20)then610
  72. 720 ifn$<>"-"then750
  73. 730 iftb=0thentb=1:an$="-":printleft$(tb$,33)"-[175][157]";
  74. 740 goto610
  75. 750 ifn$=chr$(13)then780
  76. 760 iftb<4thenprintleft$(tb$,33+tb);n$;"[175][157]";:tb=tb+1:an$=an$+n$
  77. 770 goto610
  78. 780 an=val(an$):printd$;"[175]      ";:an$="":tb=0
  79. 790 cf=0:forxx=0to2:ifa(xx)=anandy(xx)<221thengosub860
  80. 800 next:iftc>=20then1000
  81. 810 ifcf>0then850
  82. 820 wt=wt+1:forx=0to2:y(x)=y(x)+(3-l)*10:ify(x)>200theny(x)=200
  83. 830 next:l=l-1:pokew,0:pokead,0:pokesr,240
  84. 840 pokew,17:ford=255to100step-2:pokef,d:next:pokew,0:pokesr,0
  85. 850 goto610
  86. 860 tc=tc+1:at=at+1:poke2040+xx,252:sn=xx:pokew,0:pokead,144:pokef,250
  87. 870 pokew,129:ford=1to100:next:poke2040+xx,253+xx:gosub1080:y(xx)=30:cf=1
  88. 880 bc=peek(v+31):return
  89. 890 pokev+1,0:pokev+3,0:pokev+5,0
  90. 900 print"[147]math problems invade the city":goto930
  91. 910 print"[147]you've beaten the math problems"
  92. 920 print" at their own game"
  93. 930 print"[153]game results:":print"right answers:"at
  94. 940 print"[156]wrong answers:"wt
  95. 950 print"[129]bombs reaching the city:"bh
  96. 960 print"[154]do you want another chance? (y/n)?"
  97. 970 getc$:ifc$<>"y"andc$<>"n"then970
  98. 980 ifc$="y"thenrun
  99. 990 print"[147][154]";:poke53280,14:poke53281,6:pokev+21,0:end
  100. 1000 forx=0to2:y(x)=0:pokev+1+2*x,0:next:ifl1+l2>1000then910
  101. 1010 print"[156]"tc"correct answers":tc=0
  102. 1020 print"[150]you may go on . . . ."
  103. 1030 print"                 to the next level"
  104. 1040 l1$=str$(l1):l2$=str$(l2):ifl2<l1thenl2$=l2$+"9":goto1060
  105. 1050 l1$=l1$+"9"
  106. 1060 l1=val(l1$):l2=val(l2$):print"[158]your new limits are: "l1"and"l2
  107. 1070 goto530
  108. 1080 u$=str$(int(rnd(0)*l1)):b$=str$(int(rnd(0)*l2)):b$=right$(b$,2)
  109. 1090 ift$="x"thena(sn)=val(u$)*val(b$)
  110. 1100 ift$="+"thena(sn)=val(u$)+val(b$)
  111. 1110 ift$="-"thena(sn)=val(u$)-val(b$)
  112. 1120 b$=t$+b$:u$=right$(u$,3):sy=sn*2+1+v:iflen(u$)=2thenu$=" "+u$
  113. 1130 ss=(sn+253)*64:pokew2,0:pokew2,65:fory=0to2:c1$=mid$(u$,y+1,1)
  114. 1140 forx=0to7:pokess+x*3+y,n(val(c1$),x):ifc1$=" "thenpokess+x*3+y,0
  115. 1150 pokesy,abs(peek(sy)-3):pokef2,100-10*x:nextx,y
  116. 1160 fory=0to2:c1$=mid$(b$,y+1,1):forx=8to15
  117. 1170 pokess+x*3+y,n(val(c1$),x-8):pokef2,10*x:pokesy,abs(peek(sy)-3)
  118. 1180 ifc1$=" "thenpokess+x*3+y,0
  119. 1190 ifc1$=t$thenpokess+x*3+y,n(10,x-8)
  120. 1200 nextx,y:pokew2,0
  121. 1210 pokess+48,255:pokess+49,255:pokess+50,255
  122. 1220 forx=ss+51toss+62:pokex,0:next:return
  123.